package com.gagakuai.bpm.config.httpclients;

import com.gagakuai.bpm.utils.UserUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component
@Configuration
public class FeignInterceptor implements RequestInterceptor {

    private final static String PRE_FIX = "Bearer ";

    @Override
    public void apply(RequestTemplate template) {
        template.header("Authorization", UserUtil.getToken().replace("online-token-", PRE_FIX));
    }
}
